<?php

class ApiController extends Controller
{
    public $defaultAction = 'default';

    public function actionDefault()
    {
        session_write_close();
        if (SYS_ENV=='DEV'||Yii::app()->request->isPostRequest) {
            $postjson = @file_get_contents("php://input");
            echo Yii::app()->api->call($postjson);
        } else {
            return;
        }
    }

    public function actionHook()
    {
        $data= array_merge($_POST,$_GET);
        Yii::log(json_encode(['hookdata'=>$data,'route'=>$this->getRoute()]),CLogger::LEVEL_INFO,__METHOD__);

        MsggHook::hook();
    }

}